<template>
  <page-header-wrapper :title="false">
    <a-card title="退款/变更/撤回申请管理">
      <template slot="extra">
        <a-button type="primary" icon="plus">添加业务申请单</a-button>
      </template>
      <a-tabs type="card">
        <a-tab-pane key="1" tab="全部合同"></a-tab-pane>
        <a-tab-pane key="2" tab="组审通过"></a-tab-pane>
        <a-tab-pane key="3" tab="财审中"></a-tab-pane>
        <a-tab-pane key="4" tab="财审不过"></a-tab-pane>
        <a-tab-pane key="5" tab="财审通过"></a-tab-pane>
      </a-tabs>
      <div class="table-page-search-wrapper">
        <a-form-model :model="queryParam" layout="inline">
          <a-row :gutter="48">
            <a-col :md="6" :sm="24">
              <a-form-model-item label="合同编号">
                <a-input v-model="queryParam['filter[tm_name]']" placeholder="输入业务名称"/>
              </a-form-model-item>
            </a-col>
            <template v-if="advanced">
              <a-col :md="6" :sm="24">
                <a-form-model-item label="客户姓名">
                  <a-input v-model="queryParam['filter[customer_name]']" placeholder="输入客户姓名"/>
                </a-form-model-item>
              </a-col>
              <a-col :md="6" :sm="24">
                <a-form-item label="退款时间">
                  <a-range-picker />
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="24">
                <a-form-item label="提交时间">
                  <a-range-picker />
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="24">
                <a-form-model-item label="顾问姓名">
                  <a-select v-model="queryParam['filter[status]']" placeholder="请选择业务是否开启">
                    <a-select-option value="1">1</a-select-option>
                    <a-select-option value="2">2</a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :md="6" :sm="24">
                <a-form-model-item label="是否开启">
                  <a-select v-model="queryParam['filter[status]']" placeholder="请选择业务是否开启">
                    <a-select-option value="1">1</a-select-option>
                    <a-select-option value="2">2</a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :md="6" :sm="24">
                <a-form-model-item label="审核财务">
                  <a-select v-model="queryParam['filter[status]']" placeholder="请选择审核财务">
                    <a-select-option value="1">1</a-select-option>
                    <a-select-option value="2">2</a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :md="6" :sm="24">
                <a-form-model-item label="有无尾款">
                  <a-select v-model="queryParam['filter[status]']" placeholder="请选择有无尾款">
                    <a-select-option value="1">1</a-select-option>
                    <a-select-option value="2">2</a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
            </template>
            <a-col :md="!advanced && 8 || 24" :sm="24">
              <span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
                <a-button style="margin-left: 8px" @click="reset">重置</a-button>
                <a @click="toggleAdvanced" style="margin-left: 8px">
                  {{ advanced ? '收起' : '展开' }}
                  <a-icon :type="advanced ? 'up' : 'down'"/>
                </a>
              </span>
            </a-col>
          </a-row>
        </a-form-model>
      </div>
      <div class="table-operator">
        <s-table
          bordered
          ref="table"
          :row-key="(record) => record.contract_id"
          :columns="refundColumns"
          :data="refundData"
        >
          <template slot="action">
            <a-button-group>
              <a-button type="primary">查看</a-button>
              <!--              <a-button type="danger">废弃</a-button>-->
            </a-button-group>
          </template>
        </s-table>
      </div>
    </a-card>
  </page-header-wrapper>
</template>

<script>
import { STable } from '@/components'
import financeColumns from '@/columns/finance'

export default {
  components: {
    STable
  },
  name: 'RefundContract',
  data () {
    return {
      refundColumns: financeColumns.refund,
      refundData: parameters => {
        return new Promise(resolve => {
          resolve({
            page: 1,
            page_size: 10,
            total_count: 0,
            data: []
          })
        })
      },
      queryParam: {},
      advanced: true
    }
  },
  methods: {
    toggleAdvanced () {
      this.advanced = !this.advanced
    },
    reset () {
      this.queryParam = {}
      this.$refs.table.refresh(true)
    }
  }
}
</script>

<style scoped>

</style>
